package com.example.service.impl;

import com.example.dto.User;
import com.example.mapper.UserMapper;
import com.example.repository.SysUserRepository;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private SysUserRepository sysUserRepository;

    @Override
    public List<User> getUserList(User user){
        List<User> list = null;
        try{
            list = userMapper.selectList(user);
        }catch (Exception e){

        }
        return list;
    }

    @Override
    public void insertUser(User user) {
        try{
            userMapper.insertEntity(user);
        }catch (Exception e){
        }
    }

    @Override
    public void addUser(User user) {
        sysUserRepository.save(user);
    }
}
